<?php
require_once("mailbodyView.php");
require_once(CORE_DIR.'taskModel.php');
require_once(CORE_DIR.'projectModel.php');

class reportupdatesAction extends Action{

	function __construct(){
		$this->view = new mailbodyView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$tModel = new taskModel();		
		$pModel = new projectModel();
		
		if (isset($get["uid"]) && isset($get["pid"])){
			$userId = $get["uid"];
			$projectId = $get["pid"];
			
			$taskListNew = $tModel->getUnreportedTaskList($userId, $projectId, 0);
			$taskListUpdated = $tModel->getUnreportedTaskList($userId, $projectId, 1);
			$project = $pModel->getProjectByID($projectId);
			
			$this->view->setProperty("tasks_new", $taskListNew);
			$this->view->setProperty("tasks_updated", $taskListUpdated);
			$this->view->setProperty("project", $project);
			$this->view->showReportUpdate();
		}			
	}
}
?>